﻿using Message_Management.Common;
using Message_Management.IDAL;
using Message_Management.Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;

namespace Message_Management.DAL
{
    /// <summary>
    /// 学生管理类
    /// 一组：杨帆 2018/5/18
    /// </summary>
    public class Student_InfoDAL : IStudent_InfoDAL
    {
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <param name="pwd">密码</param>
        /// <returns></returns>
        public DataTable Login(string userName, string pwd)
        {
            //sql语句 
            string sql = "select * from Student_Info where StudentID=@userName and SUBSTRING(Idcard,11,8) =@pwd";
            //参数化
            SqlParameter[] par ={
                                   new SqlParameter("@userName",userName),
                                   new SqlParameter("@pwd",pwd)
                               };
            DataTable dt = DBHelper.ExecuteDataTable(sql,par);
            return dt;
        }
    }
}
